package com.gitee.wsl.ext.db

import androidx.room.Room
import androidx.room.RoomDatabase
import com.gitee.wsl.platform.AppDirs
import java.io.File

actual inline fun <reified T : RoomDatabase> roomDatabaseBuilder(
    name: String,
    isMultiInstance: Boolean,
): RoomDatabase.Builder<T> {
    var userHome:String? = null
    userHome = try {
        AppDirs.saved.getUserDataDir()
    }catch (e:Exception){
        System.getProperty("user.home")
    }
    val dbFile = File(userHome, name)
    return Room.databaseBuilder(
        name = dbFile.absolutePath,
    )
}